{% extends "base/base.html" %}

{% comment %}

 Copyright 2013 - Tom Alessi

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and 
 limitations under the License.

{% endcomment %}

{% block content %}

<script type="text/javascript">

   $(function() {

      //Time
      $("#scan_time").timepicker({
          hourGrid: 4,
          minuteGrid: 10
      });

   });

</script>

<div class="row">
  <div class="large-8 columns">
    <div class="panel radius">

      <form enctype="multipart/form-data" method="POST" action="/adm/sscan_modify">
        {% csrf_token %}

          <div class="row">
            <div class="spacer_small"></div>
          </div>
          
          <div class="row">
            <div class="large-3 columns">Name</div>
            <div class="large-9 columns">
              {{details.0.name}}
              <br><br>
            </div>
          </div>
          
          <div class="row">
            <div class="large-3 columns">Host</div>
            <div class="large-9 columns">
              {{details.0.site__site}}
              <br><br>
            </div>
          </div>

          <div class="row">
            <div class="large-3 columns">Seed URL</div>
            <div class="large-9 columns {% if form.seed.errors %}error{% endif %}">
              <input type="text" name="seed" value="{% if not form.seed.data == None %}{{form.seed.data}}{% else %}{{details.0.seed_url__path}}{% endif %}" placeholder="Enter the seed URL (e.g. /foo)" />
              {% if form.seed.errors %}
              <small class="error">
                {% for error in form.seed.errors %}{{error}}{% endfor %}
              </small>
              {% endif %}
            </div>
          </div>

          <div class="row">
            <div class="large-3 columns">HTTP Port</div>
            <div class="large-9 columns {% if form.hport.errors %}error{% endif %}">
              <div class="horiz_stack">
                <input type="text" name="hport" class="small" value="{% if form.hport.data %}{{form.hport.data}}{% else %}{{details.0.port__hport}}{% endif %}" placeholder="Enter Port" />
              </div>
              {% if form.hport.errors %}
                <small class="error">
                  {% for error in form.hport.errors %}{{error}}{% endfor %}
                </small>
              {% endif %}
            </div>
          </div>

          <div class="row">
            <div class="large-3 columns">HTTPS Port</div>
            <div class="large-9 columns {% if form.sport.errors %}error{% endif %}">
              <div class="horiz_stack">
                <input type="text" name="sport" class="small" value="{% if form.sport.data %}{{form.sport.data}}{% else %}{{details.0.port__sport}}{% endif %}" placeholder="Enter Port" />
              </div>
              {% if form.sport.errors %}
                <small class="error">
                  {% for error in form.sport.errors %}{{error}}{% endfor %}
                </small>
              {% endif %}
            </div>
          </div>

          <div class="row">
            <div class="large-3 columns">Scheduled Time</div>
            <div class="large-9 columns {% if form.time.errors %}error{% endif %}">
              <div class="horiz_stack">
                <input type="text" name="time" class="small" id="scan_time" value="{% if form.time.data %}{{form.time.data}}{% else %}{{details.0.schedule__time|date:"H:i"}}{% endif %}" placeholder="Enter Time" />
              </div>
              <div class="horiz_stack">
                {{TIME_ZONE}}
              </div>           
              {% if form.time.errors %}
                <small class="error">
                  {% for error in form.time.errors %}{{error}}{% endfor %}
                </small>
              {% endif %}
            </div>
          </div>
          
          <div class="row">
            <div class="large-3 columns">Scheduled Day(s)</div>
            <div class="large-9 columns {% if form.monday.errors %}error{% endif %}">
              <div class="horiz_stack">
                <label><input type="checkbox" name="monday" {% if form.monday.data %}checked{% else %}{% if details.0.schedule__monday %}checked{% endif %}{% endif %} />&nbsp;M&nbsp;</label>
              </div>
              <div class="horiz_stack">
                <label><input type="checkbox" name="tuesday" {% if form.tuesday.data %}checked{% else %}{% if details.0.schedule__tuesday %}checked{% endif %}{% endif %} />&nbsp;T&nbsp;</label> 
              </div>
              <div class="horiz_stack">
                <label><input type="checkbox" name="wednesday" {% if form.wednesday.data %}checked{% else %}{% if details.0.schedule__wednesday %}checked{% endif %}{% endif %} />&nbsp;W&nbsp;</label>
              </div>
              <div class="horiz_stack">
                <label><input type="checkbox" name="thursday" {% if form.thursday.data %}checked{% else %}{% if details.0.schedule__thursday %}checked{% endif %}{% endif %} />&nbsp;TH&nbsp;</label> 
              </div>
              <div class="horiz_stack">
                <label><input type="checkbox" name="friday" {% if form.friday.data %}checked{% else %}{% if details.0.schedule__friday %}checked{% endif %}{% endif %} />&nbsp;F&nbsp;</label> 
              </div>
              <div class="horiz_stack">
                <label><input type="checkbox" name="saturday" {% if form.saturday.data %}checked{% else %}{% if details.0.schedule__saturday %}checked{% endif %}{% endif %} />&nbsp;S&nbsp;</label>
              </div>
              <div class="horiz_stack">
                <label><input type="checkbox" name="sunday" {% if form.sunday.data %}checked{% else %}{% if details.0.schedule__sunday %}checked{% endif %}{% endif %} />&nbsp;SU&nbsp;</label> 
              </div>
             {% if form.monday.errors %}
                <div class="spacer_micro"></div>
                <small class="error">
                  {% for error in form.monday.errors %}{{error}}{% endfor %}
                </small>
              {% endif %}
            </div>
          </div>
      
          <div class="row">
            <div class="large-3 columns">Active Scan</div>
            <div class="large-9 columns">
              <input type="checkbox" name="method" {% if form.method.data %}checked{% else %}{% if details.0.scan_method__active %}checked{% endif %}{% endif %} />
            </div>
          </div>

          <div class="row">
            <div class="large-3 columns"><span data-tooltip class="has-tip" title="Select to enable the scan.  De-select to disable the scan.">Scan Enabled</span></div>
            <div class="large-9 columns">
              <input type="checkbox" name="enabled" {% if form.enabled.data %}checked{% else %}{% if details.0.scan_enabled__enabled %}checked{% endif %}{% endif %} />
            </div>
          </div>

          <div class="row">
            <div class="large-3 columns"></div>
            <div class="large-9 columns">
              <input type="submit" class="small button secondary" value="submit"/>
              <a href="/adm/sscan_delete?id={{details.0.id}}" class="small button secondary"><span data-tooltip class="has-tip" data-width="210" title="If you delete a scan, all reports associated with the scan will also be deleted.  If you want to maintain historical reports, but not run new scans, disable the scan.">delete</span></a>
            </div>
          </div>
      
        <input type="hidden" name="id" value="{{details.0.id}}">
      </form>
    </div>
  </div>
</div>


{% endblock %}
